#!/usr/bin/env python3

from dataclasses import dataclass
import re
import sys
from typing import TypeAlias
import itertools

P: re.Pattern[str] = re.compile(r'(.*) \[(\S+):(\d+):(\d+)\]')

M: TypeAlias = re.Match[str]

@dataclass
class Error:
    msg: M
    file: M
    line: M
    column: M

    def test_str(self, with_file: bool = False) -> str:
        fn = f'{self.file}:' if with_file else ''
        return f'/* @@? {fn}{self.line}:{self.column} Error {self.msg}  */'


if __name__ == '__main__':
    errors: list[Error] = []
    other: list[str] = []
    for line in sys.stdin:
        if m := P.match(line):
            errors.append(Error(
                msg=m[1],
                file=m[2],
                line=m[3],
                column=m[4],
            ))
        else:
            other.append(line)
    
    by_files: dict[str, list[Error]] = {
        str(k): list(v)
        for k, v in itertools.groupby(errors, lambda e: e.file)
    }

    with_file = len(by_files) > 1
    for file, er in by_files.items():
        for e in er:
            print(e.test_str(with_file))
        print()
    
    if other:
        print('=== OTHER LOG ===')
        for line in other:
            print(line)